<?php
require_once 'phpmoko/lib/common.php';

class Session
{

	static function start($name, $path, $domain, $lifetime = 0)
	{
		session_set_cookie_params($lifetime, $path, $domain);
		session_name($name);
		session_start();
	}

	static function setValue($name, $value)
	{
		$_SESSION[$name] = $value;
	}

	static function isValue($name)
	{
		return isset($_SESSION[$name]);
	}

	static function getValue($name)
	{
		return $_SESSION[$name];
	}

	static function destroy()
	{
		$_SESSION = array();

		if (ini_get("session.use_cookies")) {
			$params = session_get_cookie_params();
			setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
		}

		session_destroy();
	}
}
?>